﻿using ShineTech.Domain.SeedWork;
using System;
using System.Collections.Generic;
using System.Text;

namespace ShineTech.Domain.Models.Kanbans
{
    public class Share : Entity, IAggregateRoot
    {
        public Guid SendUserId { get; private set; }
        public Guid ToUserId { get; private set; }
        /// <summary>
        /// 是否确认
        /// </summary>
        public bool IsConfirm { get; set; }

        public Guid KanbanId { get; private set; }

        public string SendEmail { get; set; }
        public string ToEmail { get; set; }


        public DateTime CreatedTime { get; set; }


        public Share(Guid sendUserId, Guid toUserId, bool isConfirm, Guid kanbanId,string sendEmail,string toEmail)
        {
            if (sendUserId==Guid.Empty)
                throw CustomException.NullArgument(nameof(sendUserId));
            if (toUserId == Guid.Empty)
                throw CustomException.NullArgument(nameof(toUserId));
            if (kanbanId == Guid.Empty)
                throw CustomException.NullArgument(nameof(kanbanId));
            if (string.IsNullOrWhiteSpace(sendEmail))
                throw CustomException.NullArgument(nameof(sendEmail));
            if (string.IsNullOrWhiteSpace(toEmail))
                throw CustomException.NullArgument(nameof(toEmail));

            SendUserId = sendUserId;
            ToUserId = toUserId;
            IsConfirm = isConfirm;
            KanbanId = kanbanId;
            SendEmail = sendEmail;
            ToEmail = toEmail;
            CreatedTime = DateTime.Now;

        }

        public Share() { }
    }
}
